﻿# coding: utf-8

import wx
import wx.lib.scrolledpanel as scrolled

import PostProcessorManager
import PostProcessor

class wxPanelPropertyPostProcess(scrolled.ScrolledPanel):
    def __init__(self, parent, id):
        """ Default class constructor """
        
        scrolled.ScrolledPanel.__init__(self, parent, id)
        
        self._cbPostProcess = wx.CheckBox(self, -1, TD.POST_PROCESS)
        self._cbBloom = wx.CheckBox(self, -1, TD.BLOOM)
                
        self.Bind(wx.EVT_CHECKBOX, self.__OnCbPostProcess, self._cbPostProcess)
        self.Bind(wx.EVT_CHECKBOX, self.__OnCbBloom, self._cbBloom)
        
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self._cbPostProcess, 0, wx.LEFT)
        sizer.Add(self._cbBloom, 0, wx.LEFT)
        self.SetSizer(sizer)
        
    def __OnCbPostProcess(self, e):
        cb = e.GetEventObject()
        if e.IsChecked():
            PostProcessorManager.Enable(True)
        else:
            PostProcessorManager.Enable(False)
        
    def __OnCbBloom(self, e):
        cb = e.GetEventObject()
        if e.IsChecked():
            bloomHandle = PostProcessorManager.GetPostProcessor(PostProcessorManager.PPT_BLOOM)
            PostProcessor.Enable(bloomHandle, True)
        else:
            bloomHandle = PostProcessorManager.GetPostProcessor(PostProcessorManager.PPT_BLOOM)
            PostProcessor.Enable(bloomHandle, False)
                        